/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.springvision.yuanfeng.weather.service;

import java.util.List;

import org.activiti.editor.language.json.converter.util.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.springvision.yuanfeng.weather.entity.Weather;
import com.springvision.yuanfeng.weather.mapper.WeatherMapper;

/**
 * 气象监测Service
 * @author ycb
 * @version 2018-07-20
 */
@Service
@Transactional(readOnly = true)
public class WeatherService extends CrudService<WeatherMapper, Weather> {

	public Weather get(String id) {
		return super.get(id);
	}

	public List<Weather> findList(Weather weather) {
		return super.findList(weather);
	}

	public Page<Weather> findPage(Page<Weather> page, Weather weather) {
		return super.findPage(page, weather);
	}

	@Transactional(readOnly = false)
	public void save(Weather weather) {
		super.save(weather);
	}

	@Transactional(readOnly = false)
	public void delete(Weather weather) {
		super.delete(weather);
	}

	/**
	 * 离线版用
	 * 获取id
	 * 
	 * @return
	 * @author: Elvin Zhao - 279152260@qq.com 
	 * @date: Created on 2018年7月31日 下午5:52:23
	 */
	public Weather getOne() {
		List<Weather> list = super.findList(new Weather());
		if (CollectionUtils.isNotEmpty(list)) {
			return list.get(0);
		} else {
			return null;
		}

	}
}